package guoanmaker.operator.business.service;

import guoanmaker.operator.business.model.OperatorWelcomes;
import guoanmaker.operator.business.repository.OperatorWelcomesRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

import javax.transaction.Transactional;

/**
 *  
 *
 * @author huZhaoyu 
 * @ClassName: OperatorWelcomesService
 * @Description: OperatorWelcomesService 
 * @date 2017/6/27
 */
@Service
public class OperatorWelcomesService implements OperatorWelcomesServiceInterface {
    private final OperatorWelcomesRepository operatorWelcomesRepository;

    @Autowired
    public OperatorWelcomesService(OperatorWelcomesRepository operatorWelcomesRepository) {
        this.operatorWelcomesRepository = operatorWelcomesRepository;
    }

    /** 
     * @Title: getOperatorWelcomesRepository 
     * @Description: 获取OperatorWelcomesRepository
     * @param
     * @return OperatorWelcomesRepository
     * @throws 
     */
    public OperatorWelcomesRepository getOperatorWelcomesRepository() {
        return operatorWelcomesRepository;
    }

    /** 
     * @Title: saveWelcomes 
     * @Description: 新增/修改欢迎语
     * @param
     * @return OperatorWelcomes
     * @throws 
     */
    @Override
    @Transactional
    public OperatorWelcomes saveWelcomes(OperatorWelcomes operatorWelcomes) {
        return operatorWelcomesRepository.save(operatorWelcomes);
    }

    /** 
     * @Title: getAllWelcomes 
     * @Description: 获取全部欢迎语
     * @param
     * @return OperatorWelcomes
     * @throws 
     */
    @Override
    public List<OperatorWelcomes> getAllWelcomes() {
        return operatorWelcomesRepository.findAll();
    }

    /** 
     * @Title: getWelcomesById 
     * @Description: 根据ID查找欢迎语
     * @param
     * @return OperatorWelcomes
     * @throws 
     */
    @Override
    public OperatorWelcomes getWelcomesById(String id) {
        return operatorWelcomesRepository.findOne(id);
    }

    /** 
     * @Title: deleteWelcomesById 
     * @Description: 根据ID删除欢迎语
     * @param
     * @return void
     * @throws 
     */
    @Override
    @Transactional
    public void deleteWelcomesById(String id) {
        operatorWelcomesRepository.delete(id);
    }

	
}
